package com.losdun.aftersales.jobs;

import com.losdun.aftersales.manager.NoticeManager;
import com.losdun.aftersales.service.IContractOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author Sword.Ye
 * @Date 2025/11/21
 **/
@Slf4j
@Component("orderCheckTask")
public class OrderCheckTask {

    @Autowired
    private IContractOrderService contractOrderService;
    @Autowired
    private NoticeManager noticeManager;


    public void checkOrderEndDate(){
        log.info("开始执行订单维保到期检查任务");
        contractOrderService.queryCompletedContactOrder().forEach(t->{
            log.info("开始处理订单号:{}", t.getOrderNo());
            noticeManager.orderEndDateSendNotice(t);
            contractOrderService.updateMsgSendStatus(t.getId());
        });
    }

}
